import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class see {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        for (int i=0;i<100000;i++){
            list.add((int)(Math.random()*100000));
            System.out.print(list.get(i)+",");
            if (i%30==0){
                System.out.println();
            }
        }
        Integer[] arr = new Integer[list.size()];
        list.toArray(arr);
        System.out.println("---------------------------------------------------------输出完了----------------------------------------------------------------------------------------");
        long time1=System.currentTimeMillis();
        //Arrays.sort(arr);


        /*boolean flag=true;
        int temp;
        int gap=arr.length;
        while (flag){
            gap=gap/2;
            for (int i = gap; i < arr.length; i++){
                temp=arr[i];
                int j=i;
                for (;j>=gap;j-=gap){
                    if (temp<arr[j-gap]){
                        arr[j]=arr[j-gap];
                    }else break;
                }
                arr[j]=temp;
            }
            if (gap==1) flag=false;
        }*/


        long time2=System.currentTimeMillis();
        System.out.println(Arrays.toString(arr));
        System.out.println("---------------------------------------------------------排序完了----------------------------------------------------------------------------------------");
        System.out.println(time2-time1+"ms");
    }

}
